
package Main_menu;
import Artist_Album_Management.ArtistAlbumTable;
import Artist_Management.ArtistsArchive;
import MusicGroup_Album_Management.MusicGroupsAlbumArchive;
import MusicGroup_Management.MusicGroupTable;
import javax.swing.*;

//κλάση κύριου μενού εφαρμογής Radiostsation
public class MainMenu extends javax.swing.JFrame {

    /**
     * Creates new form MainMenu
     */
    public MainMenu() {
        initComponents();
        
        setLocationRelativeTo(null);//για την εμφάνιση του παραθύρου στο κέντρο
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        entityManager1 = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("Radiostation_ProjectPU").createEntityManager();
        Logo = new javax.swing.JLabel();
        MainMenu = new javax.swing.JMenuBar();
        ManageArchives = new javax.swing.JMenu();
        Artists = new javax.swing.JMenuItem();
        MusicGroup = new javax.swing.JMenuItem();
        MusicGroupAlbum = new javax.swing.JMenuItem();
        ArtistAlbum = new javax.swing.JMenuItem();
        ManagePlaylist = new javax.swing.JMenu();
        Playlist = new javax.swing.JMenuItem();
        OtherActions = new javax.swing.JMenu();
        About = new javax.swing.JMenuItem();
        Exit = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Main Menu");
        setResizable(false);

        Logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/logo rockfm96.9.png"))); // NOI18N
        Logo.setText("ΣΥΣΤΗΜΑ ΔΙΑΧΕΙΡΙΣΗΣ ΡΑΔΙΟΦΩΝΙΚΟΥ ΣΤΑΘΜΟΥ");

        ManageArchives.setText("Διαχείριση Αρχείων");

        Artists.setText("Καλλιτέχνες");
        Artists.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ArtistsActionPerformed(evt);
            }
        });
        ManageArchives.add(Artists);

        MusicGroup.setText("Συγκροτήματα");
        MusicGroup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MusicGroupActionPerformed(evt);
            }
        });
        ManageArchives.add(MusicGroup);

        MusicGroupAlbum.setText("Άλμπουμ Συγκροτήματος");
        MusicGroupAlbum.setActionCommand("");
        MusicGroupAlbum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MusicGroupAlbumActionPerformed(evt);
            }
        });
        ManageArchives.add(MusicGroupAlbum);

        ArtistAlbum.setText("Άλμπουμ Καλλιτέχνη");
        ArtistAlbum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ArtistAlbumActionPerformed(evt);
            }
        });
        ManageArchives.add(ArtistAlbum);

        MainMenu.add(ManageArchives);

        ManagePlaylist.setText("Διαχείριση Λίστας Τραγουδιών");

        Playlist.setText("Λίστες Τραγουδιών");
        ManagePlaylist.add(Playlist);

        MainMenu.add(ManagePlaylist);

        OtherActions.setText("Λοιπές Ενέργειες");

        About.setText("About");
        About.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AboutActionPerformed(evt);
            }
        });
        OtherActions.add(About);

        Exit.setText("Έξοδος");
        Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitActionPerformed(evt);
            }
        });
        OtherActions.add(Exit);

        MainMenu.add(OtherActions);

        setJMenuBar(MainMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(180, 180, 180)
                .addComponent(Logo)
                .addContainerGap(202, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(126, Short.MAX_VALUE)
                .addComponent(Logo, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(111, 111, 111))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ArtistsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ArtistsActionPerformed
        new ArtistsArchive().setVisible(true);//Εμφάνιση GUI "Αρχείο Καλλιτεχνών"
        dispose();//Σβήσιμο παραθύρου "Main menu"
    }//GEN-LAST:event_ArtistsActionPerformed

    private void MusicGroupAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MusicGroupAlbumActionPerformed
        new MusicGroupsAlbumArchive().setVisible(true);//Εμφάνιση GUI "Πίνακας Άλμπουμ Συγκροτημάτων"
        dispose();//Σβήσιμο παραθύρου "Main menu"
    }//GEN-LAST:event_MusicGroupAlbumActionPerformed

    private void MusicGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MusicGroupActionPerformed
        new MusicGroupTable().setVisible(true);
        dispose();
    }//GEN-LAST:event_MusicGroupActionPerformed
//μέθοδος για την απεικόνιση διάφορων στοιχείων της εφαρμογής(εκδότης,ημερ.παράδοσης κτλ.)
    private void AboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutActionPerformed
        new About().setVisible(true);
    }//GEN-LAST:event_AboutActionPerformed
//μέθοδος για την έξοδο από την εφαρμογή
    private void ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitActionPerformed
        /* ΛΕΙΤΟΥΡΓΙΑ ΕΞΟΔΟΥ */
        /* Επιβεβαίωση για Έξοδο */
        int choice = JOptionPane.showConfirmDialog(null, "Είστε σίγουρος ότι θέλετε να αποσυνδεθείτε?", "ΑΠΟΣΥΝΔΕΣΗ",JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (choice == 0)
            /* Κλείσιμο παραθύρου */
            dispose();                        
    }//GEN-LAST:event_ExitActionPerformed

    private void ArtistAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ArtistAlbumActionPerformed
        new ArtistAlbumTable().setVisible(true);
        dispose();
    }//GEN-LAST:event_ArtistAlbumActionPerformed

    
    
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainMenu().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem About;
    private javax.swing.JMenuItem ArtistAlbum;
    private javax.swing.JMenuItem Artists;
    private javax.swing.JMenuItem Exit;
    private javax.swing.JLabel Logo;
    private javax.swing.JMenuBar MainMenu;
    private javax.swing.JMenu ManageArchives;
    private javax.swing.JMenu ManagePlaylist;
    private javax.swing.JMenuItem MusicGroup;
    private javax.swing.JMenuItem MusicGroupAlbum;
    private javax.swing.JMenu OtherActions;
    private javax.swing.JMenuItem Playlist;
    private javax.persistence.EntityManager entityManager1;
    // End of variables declaration//GEN-END:variables
}
